const Token = require('../controller/Token')
const Constant = require('../constant/constant')
const exportObj = {
    VerifyToken
};
module.exports = exportObj;
function VerifyToken(req,res,next) {
    let token = req.headers.token;
    console.log(token);
    let tokenVerifyObj = Token.decrypt(token)
    console.log(tokenVerifyObj);
    console.log(tokenVerifyObj.token);
    if(tokenVerifyObj.token){
        next()
    }else{
        res.json(Constant.TOKEN_ERROR)
    }
}